/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.asistente.entidades;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Wizard
 */
@Entity
@Table(name = "hd_historial")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "HdHistorial.findAll", query = "SELECT h FROM HdHistorial h"),
    @NamedQuery(name = "HdHistorial.findByCodTicket", query = "SELECT h FROM HdHistorial h WHERE h.hdHistorialPK.codTicket = :codTicket"),
    @NamedQuery(name = "HdHistorial.findByCodHistorial", query = "SELECT h FROM HdHistorial h WHERE h.hdHistorialPK.codHistorial = :codHistorial"),
    @NamedQuery(name = "HdHistorial.findByFecHistorial", query = "SELECT h FROM HdHistorial h WHERE h.fecHistorial = :fecHistorial"),
    @NamedQuery(name = "HdHistorial.findByEstadoHistorial", query = "SELECT h FROM HdHistorial h WHERE h.estadoHistorial = :estadoHistorial"),
    @NamedQuery(name = "HdHistorial.findByObservaciones", query = "SELECT h FROM HdHistorial h WHERE h.observaciones = :observaciones")})
public class HdHistorial implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected HdHistorialPK hdHistorialPK;
    @Column(name = "FEC_HISTORIAL")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecHistorial;
    @Size(max = 10)
    @Column(name = "ESTADO_HISTORIAL")
    private String estadoHistorial;
    @Size(max = 100)
    @Column(name = "OBSERVACIONES")
    private String observaciones;
    @JoinColumn(name = "COD_TICKET", referencedColumnName = "COD_TICKET", insertable = false, updatable = false)
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private HdTickets hdTickets;

    public HdHistorial() {
    }

    public HdHistorial(HdHistorialPK hdHistorialPK) {
        this.hdHistorialPK = hdHistorialPK;
    }

    public HdHistorial(int codTicket, int codHistorial) {
        this.hdHistorialPK = new HdHistorialPK(codTicket, codHistorial);
    }

    public HdHistorialPK getHdHistorialPK() {
        return hdHistorialPK;
    }

    public void setHdHistorialPK(HdHistorialPK hdHistorialPK) {
        this.hdHistorialPK = hdHistorialPK;
    }

    public Date getFecHistorial() {
        return fecHistorial;
    }

    public void setFecHistorial(Date fecHistorial) {
        this.fecHistorial = fecHistorial;
    }

    public String getEstadoHistorial() {
        return estadoHistorial;
    }

    public void setEstadoHistorial(String estadoHistorial) {
        this.estadoHistorial = estadoHistorial;
    }

    public String getObservaciones() {
        return observaciones;
    }

    public void setObservaciones(String observaciones) {
        this.observaciones = observaciones;
    }

    public HdTickets getHdTickets() {
        return hdTickets;
    }

    public void setHdTickets(HdTickets hdTickets) {
        this.hdTickets = hdTickets;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (hdHistorialPK != null ? hdHistorialPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof HdHistorial)) {
            return false;
        }
        HdHistorial other = (HdHistorial) object;
        if ((this.hdHistorialPK == null && other.hdHistorialPK != null) || (this.hdHistorialPK != null && !this.hdHistorialPK.equals(other.hdHistorialPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.asistente.DAO.HdHistorial[ hdHistorialPK=" + hdHistorialPK + " ]";
    }
    
}
